home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / lists / src / remhead.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.5 KB  |  79 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: remhead.c 1.1 1995/11/05 22:49:09 digulla Exp digulla $
  4.     $Log: remhead.c $
  5.  * Revision 1.1  1995/11/05  22:49:09  digulla
  6.  * Initial revision
  7.  *
  8.     Desc:
  9.     Lang: english
  10. */
  11. /* I want the macros */
  12. #define AROS_ALMOST_COMPATIBLE
  13. #include "exec_intern.h"
  14.  
  15. /*****************************************************************************
  16.  
  17.     NAME */
  18.     #include <exec/lists.h>
  19.     #include <clib/exec_protos.h>
  20.  
  21.     __AROS_LH1I(struct Node *, RemHead,
  22.  
  23. /*  SYNOPSIS */
  24.     __AROS_LA(struct List *, list, A0),
  25.  
  26. /*  LOCATION */
  27.     struct SysBase *, SysBase, 43, Exec)
  28.  
  29. /*  FUNCTION
  30.     Remove the first node from a list.
  31.  
  32.     INPUTS
  33.     list - Remove the node from this list
  34.  
  35.     RESULT
  36.     The node that has been removed.
  37.  
  38.     NOTES
  39.  
  40.     EXAMPLE
  41.     struct List * list;
  42.     struct Node * head;
  43.  
  44.     // Remove node and return it
  45.     head = RemHead (list);
  46.  
  47.     BUGS
  48.  
  49.     SEE ALSO
  50.  
  51.     INTERNALS
  52.  
  53.     HISTORY
  54.     26-08-95    digulla created after EXEC-Routine
  55.     26-10-95    digulla adjusted to new calling scheme
  56.  
  57. ******************************************************************************/
  58. {
  59.     struct Node * node;
  60.  
  61.     assert (list);
  62.     /*
  63.     Unfortunately, there is no (quick) check that the node
  64.     is in a list
  65.     */
  66.  
  67.     /* Get the address of the first node or NULL */
  68.     if (node = GetHead (list))
  69.     {
  70.     /* normal code to remove a node */
  71.     node->ln_Pred->ln_Succ = node->ln_Succ;
  72.     node->ln_Succ->ln_Pred = node->ln_Pred;
  73.     }
  74.  
  75.     /* Return the address or NULL */
  76.     return node;
  77. } /* RemHead */
  78.  
  79.